namespace Lion.Reports
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;
    using System.Data;
    using System.Linq;

    /// <summary>
    /// Summary description for GeneralJournal.
    /// </summary>
    public partial class GeneralJournal : Telerik.Reporting.Report
    {
        public GeneralJournal()
        {
            InitializeComponent();
        }

        public GeneralJournal(DataTable dataTable, DateTime from, DateTime to)
            : this()
        {
            txtFrom.Value = from.ToString("MM / dd / yyyy");
            txtTo.Value = to.ToString("MM / dd / yyyy");

            dataTable.Columns.Add("Account", typeof(string));
            dataTable.Columns.Add("AccountCategory", typeof(string));
            foreach (DataRow row in dataTable.Rows)
            {
                var account = Lion.Account.All[row["AccountID"].ToString()];
                row["Account"] = account.Name;
                row["AccountCategory"] = account.AccountCategory.Name;
            }
            this.DataSource = dataTable;
        }


    }
}